/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package se.kth.lwr.jeat.core;

import java.util.List;
import java.util.Set;
import se.kth.lwr.jeat.core.Report.ReportRecord;

/**
 *
 * @author david
 * 
 * The InventoryDataSource is a DataSource which delivers an {@link Inventoriable}.
 * Basically this Inventoriable in turn could be everything from a single raw 
 * emission to the sum up of a hole LCA.
 */
public class InventoryDataSource extends DataSource<Inventoriable> {
    
    /**Creates a new IventoryDataSource
     * 
     * @param name The name of the DataSource
     * @param description The description of the DataSource
     */
    
    private Inventory inventory;

    public InventoryDataSource(String name, String description, Inventoriable inventoriable) {
        super(name, description, inventoriable);
        this.inventory=inventoriable.getInventory();
        
    }

    @Override
    public Report getReport() {
        Report retval=new Report();
        retval.addRow("[InventoryDataSource]",getDescription());
        List<ReportRecord> records=inventory.getReport().getReportRecords();
        for (ReportRecord reportRecord : records) {
            retval.addRow(reportRecord.getKey(),reportRecord.getValue(),reportRecord.getUnit(),reportRecord.getComment());
        }
        return retval;
    }
    
    
    
    
  
    
}
